package ltd.ninefish.framework.systemapi.service;

import ltd.ninefish.framework.core.constant.SecurityConst;
import ltd.ninefish.framework.core.constant.ServiceNameConst;
import ltd.ninefish.framework.core.result.Result;
import ltd.ninefish.framework.systemapi.dto.SysLoginInfoDto;
import ltd.ninefish.framework.systemapi.dto.SysOperLogDto;
import ltd.ninefish.framework.systemapi.factory.RemoteLogFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @author zhaoxiubin
 * create-time 2024-01-16 8:30
 * description 日志服务
 **/
@FeignClient(contextId = "remoteLogService", value = ServiceNameConst.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService {
    /**
     * 保存操作日志
     *
     * @param sysOperLog 操作日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/operlog")
    public Result<Boolean> saveLog(@RequestBody SysOperLogDto sysOperLog, @RequestHeader(SecurityConst.FROM_SOURCE) String source);

    /**
     * 保存访问记录
     *
     * @param sysLoginInfo 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logininfo")
    public Result<Boolean> saveLoginInfo(@RequestBody SysLoginInfoDto sysLoginInfo, @RequestHeader(SecurityConst.FROM_SOURCE) String source);
}
